package com.aaa.service.systemmanage.impl;

import com.aaa.aspect.InsertAnn;
import com.aaa.aspect.UpdateAnn;
import com.aaa.entity.systemmanage.Dept;
import com.aaa.dao.systemmanage.DeptDao;
import com.aaa.entity.PageSortEntity;
import com.aaa.service.systemmanage.DeptService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 部门表(Dept)表服务实现类
 *
 * @author makejava
 * @since 2022-08-30 19:45:02
 */
@Service("deptService")
public class DeptServiceImpl implements DeptService {
    @Resource
    private DeptDao deptDao;

    //分页查询所有
    @Override
    public Page queryAll(PageSortEntity pageSortEntity, Dept dept) {
        //分页
        PageHelper.startPage(pageSortEntity.getPage(), pageSortEntity.getLimit(), pageSortEntity.getOrderString());
        List<Dept> questionMhts = deptDao.queryAll(dept);
        Page pageResult = (Page) questionMhts;
        return pageResult;
    }

    //查询所有填充下拉框
    @Override
    public List<Dept> queryAllToSelect() {
        return deptDao.queryAllToSelect();
    }

    /**
     * 新增数据
     *
     * @param dept 实例对象
     * @return 实例对象
     */
    @InsertAnn
    @Override
    public boolean insert(Dept dept) {
        return deptDao.insert(dept);
    }

    /**
     * 修改数据
     *
     * @param dept 实例对象
     * @return 实例对象
     */
    @UpdateAnn
    @Override
    public boolean update(Dept dept) {
        return deptDao.update(dept);
    }

    //删除
    @Override
    public boolean deleteUser(List list) {
        return deptDao.deleteUser(list);
    }


}
